<?php
/**
   {product id=productId}
*/

function smarty_function_product($params)
{
     global $smarty;

     $product = new Product($params['id']);
     $smarty->assign('product', $product);
     
     $productImages = $product->images();
     if (!empty($productImages)) {
        $thumb = new Thumbnail($productImages[0], 200, 200);
        $smarty->assign('productImage',$thumb->toArray());
     }

     $manufacturer = new Manufacturer($product->manufacturerId());
     $smarty->assign('manufacturer', $manufacturer);

     return $smarty->fetch("components/product.tpl");
}
 
?>